package com.muyu.user.domain.model;

import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import com.muyu.user.domain.SysUserBalance;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import lombok.experimental.SuperBuilder;

/**
 * 余额变动分页查询返回模型
 *
 * @author liuguoqiang
 * @date 2025-09-18
 */
@Data
@SuperBuilder
@AllArgsConstructor
@Schema(description = "余额变动分页查询返回模型")
public class SysUserBalancePageQueryModel {

    /**
     * 变动金额
     */
    @Schema(name = "changeAmount", title = "变动金额", description = "变动金额" )
    private BigDecimal changeAmount;

    /**
     * 变动后余额
     */
    @Schema(name = "balanceAfter", title = "变动后余额", description = "变动后余额" )
    private BigDecimal balanceAfter;

    /**
     * 变动类型
     */
    @Schema(name = "changeType", title = "变动类型", description = "变动类型" )
    private String changeType;

    /**
     * 备注
     */
    @Schema(name = "remark", title = "备注", description = "备注" )
    private String remark;
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date createTime;

    /**
     * 信息构造器
     */
    public static SysUserBalancePageQueryModel infoBuild(SysUserBalance sysUserBalance){
        return SysUserBalancePageQueryModel.builder()
            .changeAmount(sysUserBalance.getChangeAmount())
            .balanceAfter(sysUserBalance.getBalanceAfter())
            .changeType(sysUserBalance.getChangeType())
            .remark(sysUserBalance.getRemark())
                .createTime(sysUserBalance.getCreateTime())
            .build();
    }

}
